package com.youzu.chuang;

import java.util.concurrent.TimeUnit;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

public class SubmitSwingProgram extends JFrame{

	private static final long serialVersionUID = 1L;
	
	private JLabel label;
	
	public SubmitSwingProgram() {
		super("Hello Swing");
		label = new JLabel("A Label");
		add(label);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(300, 100);
		setVisible(true);
	}

	private static SubmitSwingProgram ssp;
	
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable(){

			@Override
			public void run() {
				ssp = new SubmitSwingProgram();
			}
			
		});
		try {
			TimeUnit.SECONDS.sleep(1);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		
		SwingUtilities.invokeLater(new Runnable(){

			@Override
			public void run() {
				ssp.label.setText("Hey! This is Different");
			}
			
		});
		
	}

}
